/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "trade_fundtransfer")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FundTransfer.findAll", query = "SELECT f FROM FundTransfer f"),
    @NamedQuery(name = "FundTransfer.findById", query = "SELECT f FROM FundTransfer f WHERE f.id = :id"),
    @NamedQuery(name = "FundTransfer.findByRegionID", query = "SELECT f FROM FundTransfer f WHERE f.regionID = :regionID"),
    @NamedQuery(name = "FundTransfer.findByAccountCode", query = "SELECT f FROM FundTransfer f WHERE f.accountCode = :accountCode"),
    @NamedQuery(name = "FundTransfer.findByDirect", query = "SELECT f FROM FundTransfer f WHERE f.direct = :direct"),
    @NamedQuery(name = "FundTransfer.findByAmount", query = "SELECT f FROM FundTransfer f WHERE f.amount = :amount"),
    @NamedQuery(name = "FundTransfer.findByDate", query = "SELECT f FROM FundTransfer f WHERE f.date = :date"),
    @NamedQuery(name = "FundTransfer.findByTime", query = "SELECT f FROM FundTransfer f WHERE f.time = :time"),
    @NamedQuery(name = "FundTransfer.findByDateTime", query = "SELECT f FROM FundTransfer f WHERE f.dateTime = :dateTime"),
    @NamedQuery(name = "FundTransfer.findByCurrency", query = "SELECT f FROM FundTransfer f WHERE f.currency = :currency"),
    @NamedQuery(name = "FundTransfer.findByChecker", query = "SELECT f FROM FundTransfer f WHERE f.checker = :checker"),
    @NamedQuery(name = "FundTransfer.findByReMark", query = "SELECT f FROM FundTransfer f WHERE f.reMark = :reMark"),
    @NamedQuery(name = "FundTransfer.findByIsEffectived", query = "SELECT f FROM FundTransfer f WHERE f.isEffectived = :isEffectived"),
    @NamedQuery(name = "FundTransfer.findByReplyMsg", query = "SELECT f FROM FundTransfer f WHERE f.replyMsg = :replyMsg"),
    @NamedQuery(name = "FundTransfer.findByOwnUserID", query = "SELECT f FROM FundTransfer f WHERE f.ownUserID = :ownUserID"),
    @NamedQuery(name = "FundTransfer.findByAlterUserID", query = "SELECT f FROM FundTransfer f WHERE f.alterUserID = :alterUserID"),
    @NamedQuery(name = "FundTransfer.findByCreateTime", query = "SELECT f FROM FundTransfer f WHERE f.createTime = :createTime"),
    @NamedQuery(name = "FundTransfer.findByTimeStamp", query = "SELECT f FROM FundTransfer f WHERE f.timeStamp = :timeStamp")})
public class FundTransfer implements Serializable {
	public static byte[] EnCode(FundTransfer msg) throws IOException {
		Codec<FundTransfer> Lcode = ProtobufProxy.create(FundTransfer.class);
		return Lcode.encode(msg);
	}
	public static FundTransfer DeCode(byte[] data) throws IOException {
	Codec<FundTransfer> Lcode = ProtobufProxy.create(FundTransfer.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Column(name = "RegionID")
    @Protobuf
	private String regionID;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    @Basic(optional = false)
    @Column(name = "Direct")
    @Protobuf
	private String direct;
    @Basic(optional = false)
    @Column(name = "Amount")
    @Protobuf
	private double amount;
    @Basic(optional = false)
    @Column(name = "Date")
    @Temporal(TemporalType.DATE)
    private Date date;
	@Protobuf
	private long dateL;
    @Column(name = "Time")
    @Temporal(TemporalType.TIME)
    private Date time;
	@Protobuf
	private long timeL;
    @Column(name = "DateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateTime;
	@Protobuf
	private long dateTimeL;
    @Column(name = "Currency")
    @Protobuf
	private String currency;
    @Column(name = "Checker")
    @Protobuf
	private String checker;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Basic(optional = false)
    @Column(name = "IsEffectived")
    @Protobuf
	private String isEffectived;
    @Column(name = "ReplyMsg")
    private String replyMsg;
	@Protobuf
	private byte[] replyMsgBit;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public FundTransfer() {
    }

    public FundTransfer(Integer id) {
        this.id = id;
    }

    public FundTransfer(Integer id, String accountCode, String direct, double amount, Date date, String isEffectived) {
        this.id = id;
        this.accountCode = accountCode;
        this.direct = direct;
        this.amount = amount;
        this.date = date;
		this.dateL = CodeTool.DateToLong(date);
        this.isEffectived = isEffectived;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRegionID() {
        return regionID;
    }

    public void setRegionID(String regionID) {
        this.regionID = regionID;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public String getDirect() {
        return direct;
    }

    public void setDirect(String direct) {
        this.direct = direct;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
        this.setDateL(CodeTool.DateToLong(date));
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
		this.setTimeL(CodeTool.DateToLong(time));
    }

    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
		this.dateTimeL = CodeTool.DateToLong(dateTime);
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getChecker() {
        return checker;
    }

    public void setChecker(String checker) {
        this.checker = checker;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
		this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getIsEffectived() {
        return isEffectived;
    }

    public void setIsEffectived(String isEffectived) {
        this.isEffectived = isEffectived;
    }

    public String getReplyMsg() {
        return replyMsg;
    }

    public void setReplyMsg(String replyMsg) {
        this.replyMsg = replyMsg;
		this.setReplyMsgBit(CodeTool.StringToBit(replyMsg));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FundTransfer)) {
            return false;
        }
        FundTransfer other = (FundTransfer) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.FundTransfer[ id=" + id + " ]";
    }

    public long getDateL() {
        return dateL;
    }

    public void setDateL(long dateL) {
        this.dateL = dateL;
		this.date = CodeTool.LongToDate(dateL);
    }

    public long getTimeL() {
        return timeL;
    }

    public void setTimeL(long timeL) {
        this.timeL = timeL;
    }

    public long getDateTimeL() {
        return dateTimeL;
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }

    public byte[] getReplyMsgBit() {
        return replyMsgBit;
    }

    public void setReplyMsgBit(byte[] replyMsgBit) {
        this.replyMsgBit = replyMsgBit;
		this.replyMsg = CodeTool.BitToString(replyMsgBit);
    }
    
}
